"""案例2 【发送表单格式的post请求】，使用requests库，完成登录接口调用，返回“验证码错
误”即可 请求地址是： http://127.0.0.1/index.php?m=Home&c=User&a=do_login&t=0.999
687125390627 请求头：Content-Type: application/x-www-form-urlencoded;
charset=UTF-8 请求体：username=13800000000&password=123456&verify_code=8888"""
#导包
import requests
#发送请求
resp = requests.post(url='http://127.0.0.1/index.php?m=Home&c=User&a=do_login&t=0.999687125390627',
                         headers={"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"},
                         data={"username": "13800000000", "password": "123456", "verify_code": "8888"})
#查看响应数据
print(resp.text)
print(resp.json())
#查看响应信息
print(resp.status_code)
print(resp.headers)
print(resp.url)
print(resp.encoding)
print(resp.cookies)
